Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom toXContent implementations #13833

Closed
wants to merge 3 commits into from

Conversation

shiv0408
Copy link
Member

Description

[Describe what this change achieves]

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • API changes companion pull request created.
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Copy link
Contributor

❌ Gradle check result for d844a7f: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@@ -101,13 +104,46 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.startObject();
{
builder.field("repository", entry.repository);
if (params.param(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_API).equals(Metadata.CONTEXT_MODE_GATEWAY)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the BWC for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default when we are using toXContent API mode is passed, we only pass Gateway when we are saving cluster state as persisted state in remote. So, by default I am putting the params as API and only adding extra fields if the mode is Gateway mode which is only used in our use case.

Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Copy link
Contributor

github-actions bot commented Jun 5, 2024

❌ Gradle check result for 5a0cf23: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Jun 5, 2024

❌ Gradle check result for d02aed3: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Copy link
Contributor

github-actions bot commented Jun 5, 2024

✅ Gradle check result for 5a2cc20: SUCCESS

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 47.33010% with 217 lines in your changes missing coverage. Please review.

Project coverage is 71.62%. Comparing base (b15cb0c) to head (5a2cc20).
Report is 348 commits behind head on main.

Files Patch % Lines
...java/org/opensearch/cluster/RestoreInProgress.java 0.00% 105 Missing ⚠️
...va/org/opensearch/cluster/SnapshotsInProgress.java 61.01% 59 Missing and 10 partials ⚠️
...pensearch/cluster/RepositoryCleanupInProgress.java 0.00% 25 Missing ⚠️
...pensearch/cluster/SnapshotDeletionsInProgress.java 78.26% 7 Missing and 8 partials ⚠️
...main/java/org/opensearch/repositories/IndexId.java 85.71% 1 Missing and 1 partial ⚠️
...main/java/org/opensearch/snapshots/SnapshotId.java 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13833      +/-   ##
============================================
+ Coverage     71.42%   71.62%   +0.20%     
- Complexity    59978    61348    +1370     
============================================
  Files          4985     5063      +78     
  Lines        282275   288416    +6141     
  Branches      40946    41770     +824     
============================================
+ Hits         201603   206592    +4989     
- Misses        63999    64764     +765     
- Partials      16673    17060     +387     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

String currentFieldName = parser.currentName();
parser.nextToken();
switch (currentFieldName) {
case "snapshot":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be made constant.

@shiv0408
Copy link
Member Author

shiv0408 commented Jun 7, 2024

#13576 (comment)

@shiv0408 shiv0408 closed this Jun 7, 2024
@shiv0408 shiv0408 deleted the custom_xContent branch June 7, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants